import request from '@/utils/request'
import linq from 'linq'
export async function get权限(XXID,CJPC){
    //
    let res =  await request({
        url: `/Right?$apply=filter(XXID eq '${XXID}' and CJPC eq '${CJPC}')`,
        method: 'get',
      })
    return res.data.value;
    //
    
}
export async function report(xxid,cjpc,password){
  let res = await request({url:`/report?code=${xxid}&year=${cjpc}&password=${password}`,method:'get'})
  return res.data.value;
}
export async function getReportList(xxid,cjpc,passsword){
  
  let res = await request({url:`/getReportList?code=${xxid}&year=${cjpc}&password=${passsword}`,method:'get'})
  
  return res.data.returnData;
}
export async function getCheckList(xxid,cjpc){
  
  let res = await request({url:`/getMyCheckList?XXID=${xxid}&CJPC=${cjpc}`,method:'get'})
  
  return res.data;
}
export async function getCheckData(xxid,cjpc){
  
  let res = await request({url:`/getCheckData?XXID=${xxid}&CJPC=${cjpc}`,method:'get'})
  
  return res.data;
}

export async function getLock(XXID,CJPC){
  //
  let res =  await request({
      url: `/Lock?$apply=filter(XXID eq '${XXID}' and CJPC eq '${CJPC}')`,
      method: 'get',
    })
  return res.data.value;
  //
  
}
export async function get登录日志(XXID,CJPC){
  //
  let res =  await request({
      url: `/LoginLog?$apply=filter(XXID eq '${XXID}' and CJPC eq '${CJPC}')`,
      method: 'get',
    })
  return res.data.value;
  //
  
}
export async function add登录日志(model){
  //
  let res =  await request({
    url: '/LoginLog',
    method: 'post',
    data: model,
  })
  return res.data;
  //
  
}

export async function update权限(model){
    let res =  await request({
        url: `/Right(${model.ID})`,
        method: 'put',
        data: model
      })
      return res.data;
}
export async function updateLock(model){
  let res =  await request({
      url: `/Lock(${model.ID})`,
      method: 'put',
      data: model
    })
    return res.data;
}

export async function delete权限(model){
    let res = await  request({
        url: `/Right/${model.ID}`,
        method: 'delete',
      })
      return res.data;
}
export async function add权限(model){
    let res =  await request({
      url: '/Right',
      method: 'post',
      data: model,
    })
    return res.data;
}
export async function addLock(model){
  let res =  await request({
    url: '/Lock',
    method: 'post',
    data: model,
  })
  return res.data;
}